public class Const implements Stream {
    private String str;
    private int count = 0;

    public Const(String str) {
        this.str = str;
    }

    public String next() {
        incCounter();
        return returnCounterStr();
    }

    public String prev() {
        decCounter();
        return returnCounterStr();
    }

    public void reset() {
        count = 0;
    }

    private String returnCounterStr() {
        String res = null;
        if (count == 1) {
            res = str;
        }
        return res;
    }

    private void incCounter() {
        if (count < 2) {
            count++;
        }
    }

    private void decCounter() {
        if (count > 0) {
            count--;
        }
    }
}
